<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>计算器</title>
	</head>
	<body>
		<form name="com">
		<input type="text" name="num1" id="num1" value="" />
		<select name="fuhao">
			<option value=""> </option>
			<option value="+">+</option>
			<option value="-">-</option>
			<option value="*">*</option>
			<option value="/">/</option>
		</select>
		<input type="text" name="num2" id="num2" value="" />
		结果：<input type="text" name="result" id="result" value=""  />
		<br>
		<button type="button"  onclick="calc()" >提交</button>
		</form>
	</body>
	<script type="text/javascript">
		  
	  function calc(){
		     var fuhao =document.com.fuhao.value;
		     var num11=document.com.num1.value;
		    var num22=document.com.num2.value;
			var result ;
			var num1 = parseFloat(num11);
			var num2 = parseFloat(num22);
			
			if(fuhao=="+"){
				
				result =num1+num2;
			}
				
			if(fuhao=="-"){
				result =num1+num2;
			}
				
			if(fuhao=="*"){
				result=num1*num2;
			}
				
			if(fuhao=="/"){
				result =num1/num2;
			}
			document.com.result.value=result;
	  }
			
	</script>
</html>
